﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using _3D_Demo;

namespace _3D_Lab1
{
    public class My3DModel : MyModel
    {
        protected Model _Model;


        public My3DModel(Microsoft.Xna.Framework.Content.ContentManager content, string strModel,float scale,Vector3 potation,Matrix rotation)
        {
            _Model = content.Load<Model>(strModel);
            Rotation = rotation;
            Scale = scale;
            Position = potation;
            // TODO: Complete member initialization
        }
        public void Draw (GameTime gameTime,GraphicsDevice graphicsDevices,Effect effect,Camera camera)
        {
            foreach (ModelMesh mesh in _Model.Meshes)
            {
                foreach (BasicEffect eff in mesh.Effects)
                {
                    eff.EnableDefaultLighting();
                    eff.World =Rotation* Matrix.CreateScale(Scale)*Matrix.CreateTranslation(Position);
                    eff.View = camera.View;
                    eff.Projection = camera.Projection;
                }
                mesh.Draw();
            }
        }
        
    }
}
